function [estimates, se] = extract_est(group_profit, group_revenue, group_expend, ...
                 group_consump, group_durables, group_tempt)
%INPUT: random grouping for each variable
%OUTPUT: extracted estimates and se for each group

    file = '../Data/Meager_estimates.xlsx';  
    % Table of point estimates
    est_table = readmatrix(file,'Sheet','Estimates','Range','B4:H10');  
    % Table of standard errors
    se_table  = readmatrix(file,'Sheet','Estimates','Range','B16:H22');  
    
    % Assemble grouping into one list
    groupings    = { group_profit, group_revenue, group_expend, ...
                     group_consump, group_durables, group_tempt };  
    colIdx       = 2:7;  
    
    % Preallocate   
    totalGroups = sum( cellfun(@numel, groupings) );  
    estimates   = NaN(totalGroups,3);  
    se          = NaN(totalGroups,3);  
    
    % Loop through each grouping variable, filling row by row  
    rowCounter = 1;  
    for k = 1:numel(groupings)  
        thisGroup = groupings{k};       
        thisCol   = colIdx(k);        
        for block = 1:numel(thisGroup)  
            studies = thisGroup{block};   
            % Fill up to length in columns 1..3  
            for j = 1:numel(studies)  
                iStudy = studies(j);  
                estimates(rowCounter,j) = est_table(iStudy, thisCol);  
                se(rowCounter, j) = se_table(iStudy, thisCol);  
            end  
            rowCounter = rowCounter + 1;  
        end  
    end  

end
